#include<stdio.h>
#include<string.h>
int my_atoi(char* arr)
{
	char* tmp = arr;
	while (*tmp == ' ')
	{
		tmp++;
	}
	int num = 0;
	int count = 0;
	int result= 0;
	int sum = 0;
	if (*tmp = 45)
	{
		result = strlen(arr)-1;
	}
	else
	{
		result = strlen(arr);
	}
	while (*tmp >= 48 && *tmp <= 57)
	{
		num = (*tmp - '0') * result * 10;
		sum = sum + num;
		result--;
		tmp++;
	}
	return sum;

}
int main()
{
	char arr[] = "-123";
	printf("%zd\n", my_atoi(arr));
	return 0;
}
